fix: Add comprehensive TTL ledger testing and documentation - #218
Open
NneOdogwu wants to merge 1 commit into
Open
fix: Add comprehensive TTL ledger testing and documentation#218NneOdogwu wants to merge 1 commit into
NneOdogwu wants to merge 1 commit into
Conversation
- Add 3 new tests for ledger TTL persistence and extension:
* persistent_circle_survives_multiple_rounds_with_ttl_refresh: Verifies TTL is
actively re-extended across multiple fund/claim rounds when ledger advances
* circle_and_nullifier_entries_individually_extended: Confirms both Circle and
Nullifier entries are independently extended and survive threshold advancement
* ttl_survives_fund_after_ledger_advance: Ensures fund triggers re-extension
even after ledger advancement, allowing indefinite circle activity
- Document TTL constants with rationale:
* LEDGER_THRESHOLD = 100 (~8.3 min): re-extension trigger
* LEDGER_EXTEND_TO = 500_000 (~29 days at 5s/ledger): target TTL
- Add comprehensive archival/restoration documentation:
* Entries archived after 29+ days of inactivity
* Restoration via permissionless RestoreFootprintOp
* State is preserved; no data loss on restoration
* This addresses Acceptance Criteria in Issue crackedstudio#90
Fixes: crackedstudio#90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR addresses Issue #85 by adding comprehensive TTL (Time-To-Live) ledger testing and documenting the archival/restoration story for Sharibo circles.
Changes
Contract Tests (contracts/sharibo/src/test.rs)
Added 3 new test cases to pin TTL behavior and verify persistent entry survival:
persistent_circle_survives_multiple_rounds_with_ttl_refreshLEDGER_THRESHOLDbetween operations to trigger TTL re-extension logiccircle_and_nullifier_entries_individually_extendedLEDGER_THRESHOLDand verifies both entries remain accessibleextend_ttlis called on both storage keysttl_survives_fund_after_ledger_advanceLEDGER_THRESHOLDDocumentation Updates
Contract Code (contracts/sharibo/src/lib.rs)
Added detailed comments explaining TTL constants:
LEDGER_THRESHOLD = 100: Re-extension trigger (~8.3 minutes at 5s/ledger)LEDGER_EXTEND_TO = 500_000: Target TTL (~29 days at 5s/ledger)README (contracts/README.md)
Added new "TTL (Time-To-Live) & State Archival" section documenting:
RestoreFootprintOpAcceptance Criteria Met
✅ TTL behavior is pinned by test, not assumption
✅ Ledger advancement scenarios covered (threshold & beyond)
✅ Archival/restoration story documented
✅ TTL numbers' rationale recorded (~500k ledgers ≈ 29 days at 5s/ledger)
✅ Fund/claim operations verified to work after ledger advancement
Testing Notes
env.ledger().with_mut())Related Issue
closes #85